{% extends "dash/dashboard.html" %}

{% load avatar_tags %}

{% block menuOptions %}
{% if user.persona %}
<li><a href="{% url 'dashboard' %}">Dashboard</a></li>
<li><a href="{% url 'logbook' %}">Logbook</a></li>
{% else %}
<li><a href="{% url 'dash_empresa' %}">Dashboard</a></li>
<li><a href="{% url 'dash_planes' %}">Planes</a></li>
{% endif %}
{% endblock menuOptions %}

{% block dashboard %}
<div class="row">
    <div class="col-md-12">
        <div class="page-header">
            <h1>Recomendar</h1>
            <h2>{{ item.nombre }}</h2>
        </div>
        <form action="/items/recomendation/{{ item.id }}/" class="form-horizontal" role="form" method="post">
            {% csrf_token %}
            {% for persona in usuarios %}
            <div class="form-group">
                <div class="row">
                    <div class="col-md-2">
                        <div class="thumbnail">
                            <img src="{% avatar_url persona.user 50 %}" alt="" />
                        </div>
                    </div>
                    <div class="col-md-10">
                        <div class="input-group">
                            <span class="input-group-addon">
                                <input type="checkbox" name="recomendados" value="{{ persona.user.id }}">
                            </span>
                            <label name="recomendados" class="form-control form-control-static">{{ persona.user.first_name }} {{ persona.user.last_name }} - {{ persona.user.email }}</label>
                        </div>
                    </div>
                </div>
            </div>
            {% empty %}
            {% if user.followers %}
            <div class="form-group">
                <div class="row">
                    <div class="col-md-10">
                        <p class="well">Ya has recomendado este ítem a todos tus seguidores.</p>
                    </div>
                </div>
            </div>
            {% else %}
            <div class="form-group">
                <div class="row">
                    <div class="col-md-10">
                        <p class="well">No tienes seguidores, por lo tanto no tienes a quien recomendar éste Item.</p>
                    </div>
                </div>
            </div>
            {% endif %}
            {% endfor %}
            <div class="form-group">
                {% if usuarios %}
                <input type="submit" class="btn btn-success" value="Recomendar" class="submit" />
                {% endif %}
            </div>
        </form>
    </div>
</div>
{% endblock dashboard %}
